﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace msBsc.WebUi.mMall.Buyer
{
    public partial class mfRefund : msBsc.Cls.mbPCustom
	{
		protected void Page_Load(object sender, EventArgs e)
		{

		}

        public override void DoAction()
        {
            if (this.strAction=="setReffund")
            {
                setRefund();
            }
        }


        private void setRefund() 
        {
            string orderId = this.GetParamHtValue("orderId");
            if (string.IsNullOrEmpty(orderId))
            {
                this.Alert("订单号不能为空");
                return;
            }
            string reason_radio = this.GetParamHtValue("reason_radio");
            if (string.IsNullOrEmpty(reason_radio))
            {
                this.Alert("退款责任不能为空");
                return;
            }
            string expanation = this.GetParamHtValue("reason_txt");
            if (string.IsNullOrEmpty(expanation))
            {
                this.Alert("退款原因不能为空");
                return;
            }
            using (msBsc.AppLogic.DataAlc.CBizCustomerRefund customerRefund=new AppLogic.DataAlc.CBizCustomerRefund())
            {
                int breachPerson=1;
                int.TryParse(reason_radio, out breachPerson);
                string ret = customerRefund.ApplyRefund(orderId, expanation, breachPerson);
                if (ret!="OK")
                {
                    this.Alert(ret);
                    return;
                }
                this.ExecJScript(@"window.location.href = ""/mb_OrderInfo.htm?orderId="+orderId+@"""");
            }
        }
	}
}